import request from "@/utils/request";

export function reqRoleList(page, limit, roleName) {
  return request({
    url: `/admin/acl/role/${page}/${limit}?roleName=${roleName}`,
    method: "get",
  });
}
export function reqAddOrUpdate(form) {
  if (form.id) {
    //修改
    return request({
      url: `/admin/acl/role/update`,
      method: "put",
      data: form,
    });
  } else {
    return request({
      url: `/admin/acl/role/save`,
      method: "post",
      data: form,
    });
  }
}
export function reqDel(id) {
  return request({
    url: `/admin/acl/role/remove/${id}`,
    method: "delete",
  });
}
export function reqDelAll(idList) {
  return request({
    url: `/admin/acl/role/batchRemove`,
    method: "post",
    data: idList,
  });
}
export function reqTree(roleId) {
  return request({
    url: `/admin/acl/permission/toAssign/${roleId}`,
    method: "get",
  });
}
export function reqAdd(roleId, permissionId) {
  return request({
    url: `/admin/acl/permission/doAssign/?roleId=${roleId}&permissionId=${permissionId}`,
    method: "post",
  });
}
